using System;
using System.Collections.Generic;
using System.Text;

using Mono.GetOptions;

using NUnit.Framework;

namespace Sandia.MVCFramework.Test
{
    class DummyOptions : Options
    {
        public static readonly string DEFAULT_TITLE = "A Title";

        /// <summary>
        /// The title
        /// </summary>
        [Option("The title", "title")]
        public string Title
        {
            get
            {
                return title;
            }
            set
            {
                this.title = value;
            }
        }
        private string title = DEFAULT_TITLE;

        /// <summary>
        /// Whether or not to logging is enabled
        /// </summary>
        [Option("Enable logging", "logging")]
        public bool Logging
        {
            get
            {
                return logging;
            }
            set
            {
                this.logging = value;
            }
        }
        private bool logging = false;
    }

    [TestFixture]
    public class OptionsTests : FailOnErrorLoggingTestFixture
    {
        [Test]
        public void OptionsTest()
        {
            // Set up some dummy arguments
            string[] args = new string[2];
            args[0] = "--title:Foobar";
            args[1] = "--logging";

            // Process the arguments
            DummyOptions options = new DummyOptions();
            options.ProcessArgs(args);

            Assert.AreEqual(options.Title, "Foobar");
            Assert.AreEqual(options.Logging, true);
        }
    }
}
